<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>collection</title>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link href="../css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="../js/jquery.js"></script>
<script type="text/javascript" src="../js/bootstrap.js"></script>
<script type="text/javascript" src="../js/vue.js"></script>
<style type="text/css" media="screen">
	.glyphicon-star{
		color: #4095D5;
	}
</style>
</head>
<body>
<div id="collection">

		<!-- 导航结束 -->
		<div class="container" >
			<div class="page-side col-md-8 col-xs-8">
				<div class="page-header">
					<h1><span class="glyphicon glyphicon-star" aria-hidden="true"></span><small>我的收藏</small></h1>
				</div>
				  <table class="table table-hover table-bordered " v-show="arr.length != 0">
					<tr class="active">
						<th class="text-center">序号</th>
						<th class="text-center">名称</th>
						<!--<th class="text-center">创建时间</th>-->
						<!--<th class="text-center">操作</th>-->
					</tr>
					<tr class="text-info" v-for="(item, index) in arr">
						   <td class="text-center">{{index+1}}</td>
						   <td class="text-center">{{item.title}}</td>
						   <!--<td class="text-center"><button class="btn btn-primary btn-sm" @click="del(index)">删除</button></td>-->
					</tr>
				  </table>
			</div>

		</div>
</div>
<script type="text/javascript">
	var collection = new Vue({
		el:"#collection",
		data:{
			arr:null,
			nav:null
		},
		methods:{
			// del:function(n){
			// 	// alert(n);
			// 	this.arr.splice(n,1);
			// },


		},
        created:function() {
            let that = this;

            //我的收藏
            if(sessionStorage.tag == 1) {
                let user_id = sessionStorage.id;
                $.ajax({
                    url:'http://news.cn/index.php/index/page/selCollection',
                    type:'post',
                    data:{id:user_id},
                    dataType:'json',
                    success:function(data) {
                        // console.log(data);
                        that.arr = data.data;
                    }
                })
            }else {
                alert('您还未登陆,请先登陆');
            }
        }
	})
</script>
</body>
</html>